home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
3D World 5 (Spanish)
/
3DWorld_05.iso
/
mac
/
Edición de vídeo
/
MovieSilencer folder
/
Read Me
< prev
Wrap
Text File
|
1996-10-24
|
3KB
|
144 lines
MovieSilencer is a very simple application which strips soundtracks from
QuickTime movies.
Drop-launch a movie onto the application (or choose a movie from the open dialog).
You will be prompted for a location for the resulting movie file. You can't
overwrite the original movie because it's still in use at this point.
Like I said, this is a very simple program with practically no user interface.
If an error occurs, it just beeps at you (QuickTime isn't installed, not enough
memory, etc.)
-- Scott Lindsey <wombat@claris.com>
This program is freely distributable. MovieSilencer is neither a product of nor is
supported by Claris Corporation. Here's the source:
// (No, this isn't very good example-ware. It's just a quick hack.)
#include <MacHeaders> // Think C. If you're using MPW, you figure out what to put here.
#include <Aliases.h>
#include <Folders.h>
#include <Movies.h>
#include <ImageCompression.h>
#define SILENT "Silent "
void DeleteSnd(FSSpec *);
void main(void)
{
long response;
short Action, Count;
OSErr err;
AppFile File;
FSSpec fs;
SFTypeList types = {'MooV'};
if (Gestalt(gestaltQuickTime, &response))
{
SysBeep(5);
ExitToShell();
}
MaxApplZone();
InitGraf(&qd.thePort);
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs(0L);
InitCursor();
EnterMovies();
CountAppFiles(&Action, &Count);
if (Action == appPrint)
ExitToShell();
if (Count)
{
GetAppFiles(Count, &File);
FSMakeFSSpec(File.vRefNum, 0L, File.fName, &fs);
}
else
{
StandardFileReply reply;
StandardGetFilePreview(nil, 1, types, &reply);
if (!reply.sfGood)
ExitToShell();
fs = reply.sfFile;
Count = 1;
}
for (;;)
{
DeleteSnd(&fs);
if (!--Count)
break;
GetAppFiles(Count, &File);
FSMakeFSSpec(File.vRefNum, 0L, File.fName, &fs);
}
ExitToShell();
}
void DeleteSnd(FSSpec *fs)
{
short refNum, resID = 0, size;
Movie movie;
OSErr err;
StandardFileReply reply;
long x;
Track track;
OSType type, creator;
Str255 name;
if (err = OpenMovieFile(fs, &refNum, fsRdWrPerm))
goto failed;
if (err = NewMovieFromFile(&movie, refNum, &resID, nil, newMovieActive, nil))
goto close;
for (x = GetMovieTrackCount(movie); x; x--)
{
track = GetMovieIndTrack(movie, x);
GetMediaHandlerDescription(GetTrackMedia(track), &type, name, &creator);
if (type == SoundMediaType && (err = DeleteTrackSegment(track, GetTrackOffset(track), GetTrackDuration(track))))
goto close;
if (type == SoundMediaType)
DisposeMovieTrack(track);
}
CloseMovieFile(refNum);
size = fs->name[0];
if (size + sizeof(SILENT) > sizeof(fs->name))
size = sizeof(fs->name) - sizeof(SILENT);
BlockMove(fs->name + 1, fs->name + sizeof(SILENT), size);
BlockMove("Silent ", fs->name + 1, sizeof(SILENT) - 1);
fs->name[0] = size + sizeof(SILENT);
tryAgain:
StandardPutFile("\pSave Movie as:", fs->name, &reply);
if (reply.sfGood)
{
if ((err = FSpDelete(&reply.sfFile)) && err != fnfErr)
{
SysBeep(5);
goto tryAgain;
}
FlattenMovie(movie, 0, &reply.sfFile, 'TVOD', smCurrentScript, createMovieFileDeleteCurFile, &resID, "\p");
}
DisposeMovie(movie);
return;
close:
CloseMovieFile(refNum);
failed:
SysBeep(5);
return;
}